%{
    class ExpressionTreeNode;
    class VariableNode;
    #include <QList>
    #include "Math.parser.hpp"
    #include <string.h>

%}
DIGIT [0-9]
ID [a-zA-Z][a-zA-Z0-9]*
%%
"=="                                { return EQ; }
"!="                                { return NE; }
"<="                                { return LE; }
">="                                { return GE; }
">"                                 { return GT; }
"<"                                 { return LT; }
"="                                 { return ASSIGN; }
"+"                                 { return ADD; }
"-"                                 { return MINUS; }
"*"                                 { return MUL; }
"/"                                 { return DIV; }
"^"                                 { return POW; }
";"                                 { return ELSE; }
":"                                 { return IF; }
"|"                                 { return OR; }
"&"                                 { return AND; }
{DIGIT}+\.{DIGIT}+e\-?{DIGIT}+      { sscanf(yytext,"%le",&yylval.val);return NUMBER; }
{DIGIT}+\.{DIGIT}+                  { sscanf(yytext,"%le",&yylval.val);return NUMBER; }
{DIGIT}+                            { sscanf(yytext,"%le",&yylval.val);return NUMBER; }
"."                                 { return DOT; }
","                                 { return COMMA; }
"["                                 { return LFUNCALL; }
"]"                                 { return RFUNCALL; }
"("                                 { return LPAREN; }
")"                                 { return RPAREN; }
{ID}                                { yylval.ident = (char*)strdup(yytext); return IDENTIFIER; }
{ID}"$"[a-z0-9]*                    { yylval.ident = (char*)strdup(yytext); return IDENTIFIER; }
[ \t\n]+
.                                   { return(yytext[0]);}
%%


